##
# GroupManager build script
##

Import('env')

lib_env = env.Clone()
SConscript('#service/third_party_libs.scons', 'lib_env')
scenemanager_sample_env = lib_env.Clone()
rd_mode = lib_env.get('RD_MODE')
target_os = lib_env.get('TARGET_OS')

######################################################################
# Build flags
######################################################################
scenemanager_sample_env.AppendUnique(CPPPATH=[
    '../../include',
    '../../src',
    '#/service/resource-encapsulation/include',
    '#/extlibs/cjson',
    '#/resource/c_common',
    '#/resource/c_common/oic_malloc/include',
    '#/resource/c_common/oic_string/include',
    '#/resource/csdk/connectivity/api',
    '#/resource/csdk/include',
    '#/resource/csdk/stack/include',
    '#/resource/include',
    '#/resource/oc_logger/include'
])
scenemanager_sample_env.AppendUnique(
    CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])

scenemanager_sample_env.PrependUnique(LIBS=['scene_manager'])
scenemanager_sample_env.AppendUnique(LIBS=[
    'rcs_client',
    'rcs_server',
    'rcs_common',
    'oc',
    'octbstack',
    'oc_logger',
    'connectivity_abstraction',
    'coap',
])

if env.get('SECURED') == '1':
    scenemanager_sample_env.AppendUnique(
        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])

if 'gcc' == lib_env.get('CC') and target_os not in ['android']:
    scenemanager_sample_env.AppendUnique(CFLAGS=['-pthread'])
    scenemanager_sample_env.AppendUnique(LIBS=['pthread'])
####################################################################
# Source files and Targets
######################################################################
sceneserver = scenemanager_sample_env.Program('sceneserver', 'sceneserver.cpp')
sceneclient = scenemanager_sample_env.Program('sceneclient', 'sceneclient.cpp')
fanserver = scenemanager_sample_env.Program('fanserver', 'fanserver.cpp')
lightserver = scenemanager_sample_env.Program('lightserver', 'lightserver.cpp')

examples = [ sceneserver, sceneclient, fanserver, lightserver ]
scenemanager_sample_env.UserInstallTargetExtra(examples)
